package com.odianyun.springboottest.model.po;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @description:
 * @author: EDZ
 * @time: 19:38
 * @date: 2021/7/19
 *
 * 若添加@Document("article_db")则保存到mongo中的collection为article_db
 * 若未添加则保存的为article
 */
@Document
@CompoundIndexes({
        @CompoundIndex(name = "title_author", def = "{'title': 1, 'author' : -1}")
})
@ApiModel(value= "文章", description = "文章实体类")
public class Article implements Serializable {
    private static final long serialVersionUID = -184984517781517885L;

    @ApiModelProperty(name= "id")
    @Id
    private String id;
    /**
     * 标题
     */
    @ApiModelProperty(value = "标题", example = "河南加油")
    private String title;
    /**
     * 内容
     */
    @ApiModelProperty(hidden = true)
    @Field
    private String content;
    /**
     * 作者
     */
    private String author;

    /**
     * 标签
     */
    private List<String> tags;

    /**
     * 类型
     */
    private String type;

    /**
     * 访问数量
     */
    private Long visitNum;

    /**
     * 评分
     */
    private BigDecimal score;

    private BigDecimal price;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<String> getTags() {
        return tags;
    }

    public void setTags(List<String> tags) {
        this.tags = tags;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Long getVisitNum() {
        return visitNum;
    }

    public void setVisitNum(Long visitNum) {
        this.visitNum = visitNum;
    }

    public BigDecimal getScore() {
        return score;
    }

    public void setScore(BigDecimal score) {
        this.score = score;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }
}
